home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / hack / 3_1 / sys / msdos / makegcc.utl < prev    next >
Encoding:
Text File  |  1993-01-18  |  7.3 KB  |  315 lines

  1. #       SCCS Id: @(#)MakeGCC.utl               3.1     93/01/18
  2. #    Copyright (c) NetHack PC Development Team 1992, 1993.
  3. #       PC NetHack 3.1 Utilities Makefile for djgpp
  4. #       Gnu gcc compiler for msdos
  5. #
  6. #       For questios or comments:  Kevins@ori.org
  7. #
  8. #  In addition to your C compiler,
  9. #
  10. #  if you want to change   you will need a
  11. #  files with suffix   workalike for
  12. #         .y         yacc
  13. #         .l         lex
  14. #
  15. #       Note that flex (lex) and bison (yacc) are included with the
  16. #       djgpp distribution and work quite well.  This makefile assumes
  17. #        you have them installed correctly.
  18.  
  19. #
  20. #  Executables.
  21. #       gcc and go32 dos extender
  22.  
  23. CC      = gcc
  24. STUB    = f:\djgpp\bin\stub.exe   # Protected mode stub for go32. Either
  25. LINK    = gcc                     # stub.exe or go32.exe
  26. MAKEBIN  = make
  27.  
  28. #
  29. # Special libraries and how to link them in.
  30.  
  31. LIBS = -lpc
  32.  
  33. #
  34. #  Yacc/Lex ... if you got 'em.
  35. #
  36.  
  37. YACC  = bison -y
  38. LEX   = flex
  39.  
  40. YTABC  = y_tab.c
  41. YTABH  = y_tab.h
  42. LEXYYC   = lexyy.c
  43.  
  44. #
  45. #  Flags.
  46. #
  47.  
  48. # Debugging
  49. # CFLAGS = -g -c -I../include
  50.  
  51. CFLAGS = -I../include -c
  52. LFLAGS =
  53.  
  54.  
  55. #
  56. #       Directories, gcc likes unix style directory specs
  57. #
  58.  
  59. INCL    = ../include
  60. DAT     = ../dat
  61.  
  62. # But we must use dos directory specs to find src files, so....
  63. SRC     = ..\src
  64. DINCL   = ..\include
  65.  
  66. default: all
  67.  
  68.  
  69. #############################################################################
  70. #
  71. # nothing below this line should have to be changed
  72. #
  73.  
  74. #
  75. #  Utility Objects.
  76. #
  77.  
  78. MAKESRC     = makedefs.c
  79.  
  80. SPLEVSRC    = lev_yacc.c  lev_$(LEX).c   lev_main.c  panic.c
  81.  
  82. DGNCOMPSRC  = dgn_yacc.c  dgn_$(LEX).c   dgn_main.c
  83.  
  84. MAKEOBJS    = makedefs.o  monst.o        objects.o
  85.  
  86. SPLEVOBJS   = lev_yacc.o  lev_$(LEX).o  lev_main.o  alloc.o     \
  87.               monst.o     objects.o     panic.o  \
  88.               drawing.o   decl.o
  89.  
  90. DGNCOMPOBJS = dgn_yacc.o  dgn_$(LEX).o  dgn_main.o  alloc.o      \
  91.               panic.o
  92.  
  93. RECOVOBJS   =  recover.o
  94.  
  95. #
  96. #  Header Objects.
  97. #
  98.  
  99. DGN_FILE_H = $(INCL)\align.h    $(INCL)\dgn_file.h
  100. DUNGEON_H  = $(INCL)\align.h    $(INCL)\dungeon.h
  101. EMIN_H     = $(DUNGEON_H)       $(INCL)\emin.h
  102. EPRI_H     = $(DUNGEON_H)       $(INCL)\align.h     $(INCL)\epri.h
  103. ESHK_H     = $(DUNGEON_H)       $(INCL)\eshk.h
  104. MONDATA_H  = $(INCL)\align.h    $(INCL)\mondata.h
  105. MONST_H    = $(INCL)\align.h    $(INCL)\monst.h
  106. PERMONST_H = $(INCL)\monattk.h  $(INCL)\monflag.h   $(INCL)\align.h   \
  107.              $(INCL)\permonst.h
  108. RM_H       = $(INCL)\align.h    $(INCL)\rm.h
  109. SP_LEV_H   = $(INCL)\align.h    $(INCL)\sp_lev.h
  110. VAULT_H    = $(DUNGEON_H)       $(INCL)\vault.h
  111. YOUPROP_H  = $(PERMONST_H)      $(MONDATA_H)        $(INCL)\prop.h    \
  112.              $(INCL)\pm.h       $(INCL)\youprop.h
  113. YOU_H      = $(MONST_H)         $(YOUPROP_H)        $(INCL)\align.h   \
  114.              $(INCL)\attrib.h   $(INCL)\you.h
  115. DISPLAY_H  = $(MONDATA_H)       $(INCL)\vision.h    $(INCL)\display.h
  116. PCCONF_H   = $(INCL)\micro.h    $(INCL)\system.h    $(INCL)\pcconf.h
  117. CONFIG_H   = $(GLOBAL_H)        $(INCL)\tradstdc.h  $(INCL)\config.h
  118. DECL_H     = $(YOU_H)           $(INCL)\spell.h     $(INCL)\color.h   \
  119.              $(INCL)\obj.h      $(INCL)\onames.h    $(INCL)\pm.h      \
  120.              $(INCL)\decl.h
  121. GLOBAL_H   = $(PCCONF_H)        $(INCL)\coord.h     $(INCL)\global.h
  122. HACK_H     = $(CONFIG_H)        $(DUNGEON_H)        $(DECL_H)         \
  123.              $(DISPLAY_H)       $(INCL)\monsym.h    $(INCL)\mkroom.h  \
  124.              $(INCL)\objclass.h $(INCL)\trap.h      $(INCL)\flag.h    \
  125.              $(RM_H)            $(INCL)\vision.h    $(INCL)\wintype.h \
  126.              $(INCL)\engrave.h  $(INCL)\rect.h      $(INCL)\extern.h \
  127.              $(INCL)\trampoli.h $(INCL)\hack.h
  128.  
  129.  
  130.  
  131. #
  132. #  Make Rules.
  133. #
  134.  
  135. .SUFFIXES:  .exe .o .c .y .l
  136.  
  137. .c.o:
  138.      $(CC) $(CFLAGS) -o$*.o $*.c
  139.  
  140. #
  141. #  Primary Targets.
  142. #
  143. all:   utility.tag
  144.  
  145. utility.tag: $(INCL)\trap.h    $(INCL)\onames.h        \
  146.              $(INCL)\pm.h      $(SRC)\monstr.c   $(SRC)\vis_tab.c  \
  147.              lev_comp.exe      dgn_comp.exe    recover.exe
  148.     echo utilities made > utility.tag
  149.  
  150. clean:
  151.     del *.o
  152.     del *.map
  153.  
  154. spotless: clean
  155.     if exist utility.tag       del utility.tag
  156.     if exist makedefs.exe      del makedefs.exe
  157.     if exist lev_comp.exe      del lev_comp.exe
  158.     if exist dgn_comp.exe      del dgn_comp.exe
  159.     if exist recover.exe       del recover.exe
  160.     if exist $(INCL)\date.h    del $(INCL)\date.h
  161.     if exist $(INCL)\onames.h  del $(INCL)\onames.h
  162.     if exist $(INCL)\pm.h      del $(INCL)\pm.h
  163.     if exist $(INCL)\vis_tab.h del $(INCL)\vis_tab.h
  164.     if exist $(SRC)\monstr.c   del $(SRC)\monstr.c
  165.     if exist $(SRC)\vis_tab.c  del $(SRC)\vis_tab.c
  166.  
  167. #
  168. #  Secondary Targets.
  169. #
  170.  
  171. $(INCL)\onames.h: makedefs.exe
  172.     .\makedefs -o
  173.  
  174. $(INCL)\pm.h: makedefs.exe
  175.     .\makedefs -p
  176.  
  177. $(SRC)\monstr.c: makedefs.exe
  178.     .\makedefs -m
  179.  
  180. $(SRC)\vis_tab.h: makedefs.exe
  181.     .\makedefs -z
  182.  
  183. $(SRC)\vis_tab.c: makedefs.exe
  184.     .\makedefs -z
  185.  
  186. #
  187. #  Makedefs Stuff
  188. #
  189.  
  190. makedefs.exe:  $(MAKEOBJS)
  191.     $(CC) $(LFLAGS) $(MAKEOBJS)
  192.     copy /b $(STUB)+a.out $*.exe
  193.     del a.out
  194.  
  195. makedefs.o:  $(CONFIG_H)        $(PERMONST_H)      $(INCL)\objclass.h \
  196.              $(INCL)\monsym.h   $(INCL)\qtext.h
  197.  
  198. #
  199. #  Level Compiler Dependencies
  200. #
  201.  
  202. lev_comp.exe:  $(SPLEVOBJS)
  203.     $(CC) $(LFLAGS) $(SPLEVOBJS)
  204.     copy /b $(STUB)+a.out $*.exe
  205.     del a.out
  206.  
  207. lev_yacc.o:  $(HACK_H)   $(SP_LEV_H)    lev_yacc.c
  208.     $(CC) $(CFLAGS) -o$*.o $*.c
  209.  
  210.  
  211. lev_$(LEX).o:  $(HACK_H)   $(SP_LEV_H)    $(INCL)\lev_comp.h \
  212.                lev_$(LEX).c
  213.     $(CC) $(CFLAGS) -o$*.o $*.c
  214.  
  215. lev_main.o:  $(HACK_H)
  216.  
  217. $(INCL)\lev_comp.h: lev_yacc.c
  218.  
  219. lev_yacc.c:  lev_comp.y
  220.     $(YACC) -d lev_comp.y
  221.     copy $(YTABC) lev_yacc.c
  222.     copy $(YTABH) $(DINCL)\lev_comp.h
  223.     del $(YTABC)
  224.     del $(YTABH)
  225.  
  226.  
  227. lev_$(LEX).c:  lev_comp.l
  228.     $(LEX) lev_comp.l
  229.     copy $(LEXYYC) lev_$(LEX).c
  230.     del $(LEXYYC)
  231.  
  232.  
  233. #
  234. #  Dungeon Dependencies
  235. #
  236.  
  237. dgn_comp.exe:  $(DGNCOMPOBJS)
  238.     $(CC) $(LFLAGS) $(DGNCOMPOBJS)
  239.     copy /b $(STUB)+a.out $*.exe
  240.     del a.out
  241.  
  242. dgn_yacc.o:  $(HACK_H)   $(DGN_FILE_H)  dgn_yacc.c
  243.     $(CC) $(CFLAGS) -o$*.o $*.c
  244.  
  245. dgn_$(LEX).o:  $(HACK_H)   $(DGN_FILE_H)  $(INCL)\dgn_comp.h \
  246.                dgn_$(LEX).c
  247.     $(CC) $(CFLAGS) -o$*.o $*.c
  248.  
  249. dgn_main.o:  $(HACK_H)
  250.  
  251. $(INCL)\dgn_comp.h:  dgn_yacc.c
  252.  
  253. dgn_yacc.c: dgn_comp.y
  254.     $(YACC) -d dgn_comp.y
  255.     copy $(YTABC) dgn_yacc.c
  256.     copy $(YTABH) $(DINCL)\dgn_comp.h
  257.     del $(YTABC)
  258.     del $(YTABH)
  259.  
  260. dgn_$(LEX).c:  dgn_comp.l
  261.     $(LEX) dgn_comp.l
  262.     copy $(LEXYYC) dgn_$(LEX).c
  263.     del $(LEXYYC)
  264.  
  265. #
  266. #  Recover Utility
  267. #
  268.  
  269. recover.exe:   $(RECOVOBJS)
  270.     $(CC) $(LFLAGS) $*.o
  271.     copy /b $(STUB)+a.out $*.exe
  272.     del a.out
  273.  
  274. recover.o:   $(CONFIG_H) recover.c
  275.     $(CC) $(CFLAGS) -o$*.o $*.c
  276.  
  277. #
  278. #  Other Dependencies.
  279. #
  280.  
  281. alloc.c: $(SRC)\$*.c
  282.     copy $(SRC)\$*.c .
  283.  
  284. alloc.o: $(CONFIG_H)     alloc.c
  285.     $(CC) $(CFLAGS) -o$*.o $*.c
  286.  
  287. drawing.c: $(SRC)\$*.c
  288.     copy $(SRC)\$*.c .
  289.  
  290. drawing.o: $(CONFIG_H) drawing.c
  291.     $(CC) $(CFLAGS) -o$*.o $*.c
  292.  
  293. decl.c: $(SRC)\$*.c
  294.     copy $(SRC)\$*.c .
  295.  
  296. decl.o: $(CONFIG_H) decl.c
  297.     $(CC) $(CFLAGS) -o$*.o $*.c
  298.  
  299. monst.c: $(SRC)\$*.c
  300.     copy $(SRC)\$*.c .
  301.  
  302. monst.o: $(CONFIG_H)         $(PERMONST_H)      $(ESHK_H)          \
  303.          $(EPRI_H)           $(VAULT_H)         $(INCL)\monsym.h   \
  304.          $(INCL)\color.h     monst.c
  305.     $(CC) $(CFLAGS) -o$*.o $*.c
  306.  
  307. objects.c: $(SRC)\$*.c
  308.     copy $(SRC)\$*.c .
  309.  
  310. objects.o: $(CONFIG_H)        $(INCL)\obj.h      $(INCL)\objclass.h \
  311.            $(INCL)\prop.h     $(INCL)\color.h    objects.c
  312.     $(CC) $(CFLAGS) -o$*.o $*.c
  313.  
  314. panic.o:   $(CONFIG_H)
  315.